
#include "syscall.h"

int main(int argc, char** argv)
{
   int ret = 0;
   char* filename = "hello.txt";
   char* toWrite = "hello world";

   // open file that parent process created
   if( ret == 0 ) {
      int fd2 = open( filename );
      if( fd2 != -1 ) {
         printf( "FileDescriptor for %s is %d\n", filename, fd2 );
      } else {
         printf( "error: could not open file: %s\n", filename );
         ret = -1;
      }
   }

   //unlink the file that the parent process created
   int unlinkRetVal = 0;
   if( ret == 0 ) {
      unlinkRetVal = unlink( filename );
      if( unlinkRetVal == 0 ) {
         printf( "File %s unlinked successfully\n", filename );
      } else {
         printf( "error: could not unlink file: %s\n", filename );
         ret = -8;
      }
   }

   return ret;
}
